﻿namespace LiveLabs.Logging
{
    using System;
    using System.IO;

    public class FixtureUsingFiles
    {
        protected void CleanupFileIfExistsAfterTest(Action test, string filePath)
        {
            try
            {
                test();
            }
            finally
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
            }
        }

        protected void CleanupFilesIfExistAfterTest(Action test, params string[] filePathes)
        {
            try
            {
                test();
            }
            finally
            {
                foreach (string filePath in filePathes)
                {
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                }
            }
        }
    }
}
